package org.jeecg.modules.flower.exception;
 
import org.apache.commons.lang3.ObjectUtils;
import org.jeecg.common.util.RedisUtil;
import org.jeecg.common.util.SpringContextUtils;
import org.jeecg.modules.flower.util.CommonUtil;
import org.springframework.boot.autoconfigure.AutoConfigurationPackage;


/**
 *
 * @descriptionauthor   扣减库存台账---自定义异常类
 * @author gf
 * 2022-12-29 10:39
 * 
 * @return 
 */

@AutoConfigurationPackage
public class FlowerSubTagInfoException extends RuntimeException{
    private static final long serialVersionUID = 1L;

    public FlowerSubTagInfoException(String message){
//        super(message);
        RedisUtil redisUtil = SpringContextUtils.getApplicationContext().getBean(RedisUtil.class);
        Object isSubtagInLock = redisUtil.get(CommonUtil.SUBTAGINFOKEY);
        if(ObjectUtils.isNotEmpty(isSubtagInLock)) {
            redisUtil.del(CommonUtil.SUBTAGINFOKEY); //解除锁定
        }
        throw new RuntimeException( message );
    }
}
